package com.aiti.lulian.service.impl;

import com.aiti.base.core.base.service.iml.BaseSerivceImpl;
import com.aiti.lulian.dto.LuLianAcquisitionDto;
import com.aiti.lulian.entity.LuLianAcquisition;
import com.aiti.lulian.mapper.LuLianAcquisitionGoodsMapper;
import com.aiti.lulian.mapper.LuLianAcquisitionMapper;
import com.aiti.lulian.service.ILuLianAcquisitionService;
import com.aiti.lulian.vo.LuLianAcquisitionVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class LuLianAcquisitionServiceImpl extends BaseSerivceImpl<LuLianAcquisitionMapper, LuLianAcquisition> implements ILuLianAcquisitionService {

    @Autowired
    private LuLianAcquisitionMapper luLianAcquisitionMapper;

    @Autowired
    private LuLianAcquisitionGoodsMapper luLianAcquisitionGoodsMapper;

    @Override
    public List<LuLianAcquisitionVo> findLuLianAcquisitionListPage(Page<LuLianAcquisition> page, LuLianAcquisitionDto luLianAcquisitionDto) {
        return luLianAcquisitionMapper.findLuLianAcquisitionListPage(page, luLianAcquisitionDto);
    }

    @Override
    public LuLianAcquisitionVo findLuLianAcquisitionDetail(String baseId) {
      LuLianAcquisitionVo luLianAcquisitionVo =  luLianAcquisitionMapper.findLuLianAcquisitionDetail(baseId);
      if (luLianAcquisitionVo == null){
          return new LuLianAcquisitionVo();
      }
        luLianAcquisitionVo.setGoodsList(luLianAcquisitionGoodsMapper.findLuLianAcquisitionGoodsList(baseId));
        return luLianAcquisitionVo;
    }
}
